home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
autocad
/
acadfont.arj
/
ETEXT.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1988-06-07
|
9KB
|
296 lines
; ETEXT - ver 3.1 June 1, 1988.
; author: Terence Puls.
;
(defun getspu ()
(setq cs (- lw 65))
(setq cz 0)
(while (<= cz cs)
(setq cg (read-line fl))
(setq cz (1+ cz))
))
(defun getspl ()
(setq cs (- lw 97))
(setq cz 0)
(while (<= cz cs)
(setq cg (read-line fl))
(setq cz (1+ cz))
))
(defun ucase ()
(setq f (/ sh 24))
(if (= l2 "A")
(setq fl (open "etext.gu0" "r"))
)
(if (/= nil (member l2 '("B" "D" "E" "F" "H" "I" "K" "L" "M" "N" "P" "R")))
(setq fl (open "etext.gu1" "r"))
)
(if (/= nil (member l2 '("C" "G" "O" "Q")))
(setq fl (open "etext.gu2" "r"))
)
(if (= l2 "J")
(setq fl (open "etext.gu3" "r"))
)
(if (= l2 "S")
(setq fl (open "etext.gu4" "r"))
)
(if (= l2 "T")
(setq fl (open "etext.gu5" "r"))
)
(if (= l2 "U")
(setq fl (open "etext.gu6" "r"))
)
(if (= l2 "V")
(setq fl (open "etext.gu7" "r"))
)
(if (= l2 "W")
(setq fl (open "etext.gu8" "r"))
)
(if (= l2 "X")
(setq fl (open "etext.gu9" "r"))
)
(if (= l2 "Y")
(setq fl (open "etext.gua" "r"))
)
(if (= l2 "Z")
(setq fl (open "etext.gub" "r"))
)
(getspu)
(close fl)
; insp
)
(defun ulcase ()
(setq f (/ sh 24))
(if (/= nil (member l2 '("a" "c" "d" "e" "g" "o" "q")))
(setq fl (open "etext.g0" "r"))
)
(if (/= nil (member l2 '("b" "h" "i" "k" "l" "m" "n" "p" "r" "u")))
(setq fl (open "etext.g1" "r"))
)
(if (/= nil (member l2 '("f" "w")))
(setq fl (open "etext.g2" "r"))
)
(if (= l2 "j")
(setq fl (open "etext.g3" "r"))
)
(if (/= nil (member l2 '("s" "t")))
(setq fl (open "etext.g4" "r"))
)
(if (/= nil (member l2 '("v" "y")))
(setq fl (open "etext.g5" "r"))
)
(if (= l2 "x")
(setq fl (open "etext.g6" "r"))
)
(if (= l2 "z")
(setq fl (open "etext.g7" "r"))
)
(getspu)
(close fl)
;insp
)
(defun lcase ()
(setq f (/ sh 24))
(if (/= nil (member l2 '("a" "c" "d" "e" "g" "o" "q")))
(setq fl (open "etext.gl0" "r"))
)
(if (/= nil (member l2 '("b" "h" "i" "k" "l" "m" "n" "p" "r" "u")))
(setq fl (open "etext.gl1" "r"))
)
(if (/= nil (member l2 '("f" "w")))
(setq fl (open "etext.gl2" "r"))
)
(if (= l2 "j")
(setq fl (open "etext.gl3" "r"))
)
(if (/= nil (member l2 '("s" "t")))
(setq fl (open "etext.gl4" "r"))
)
(if (/= nil (member l2 '("v" "y")))
(setq fl (open "etext.gl5" "r"))
)
(if (= l2 "x")
(setq fl (open "etext.gl6" "r"))
)
(if (= l2 "z")
(setq fl (open "etext.gl7" "r"))
)
(getspl)
(close fl)
)
(defun gethyp ()
(setq pt (list (+ (car pt) (* fr (+ (/ sh 2.0) (* dx f)))) (+ (cadr pt) 0.0)))
(setq ej (* f fr))
(command "insert" "ebk45" pt ej f 0)
(setq ct (1+ ct))
(setq pt (list (+ (car pt) (* fr (+ sh 0.0))) (+ (cadr pt) 0.0)))
(setq lw (ascii (substr ss (1+ ct) 1)))
(setq eu (strcat "EBK" (itoa lw)))
(setq ej (* fr f))
(command "insert" eu pt ej f 0)
(setq ct (1+ ct))
(if (/= (substr ss (1+ ct) 1) ".")
(setq da 1 ))
)
(defun getsla ()
(if (or (= ro 1) (= ro 0))
(setq pt (list (+ (car pt) (* fr (+ (/ sh 2.0) (* dx f)))) (+ (cadr pt) 0.0)))
(setq pt (list (+ (car pt) (* fr (+ (* 4.33 f) (/ sh 2.0) (* dx f)))) (+ (cadr pt) 0.0)))
)
(setq ej (* f fr))
(command "insert" "ebk47" pt ej f 0)
(setq ct (1+ ct))
(setq pt (list (+ (car pt) (* fr (+ sh 0.0))) (+ (cadr pt) 0.0)))
(setq lw (ascii (substr ss (1+ ct) 1)))
(setq eu (strcat "EBK" (itoa lw)))
(setq ej (* fr f))
(command "insert" eu pt ej f 0)
(setq ct (1+ ct))
(if (/= (substr ss (1+ ct) 1) ".")
(setq da 1))
)
(defun c:etext ()
(menucmd "s=etext")
(setq wh (getstring "\n Enter series (C, D or E):"))
(setq wh (strcase wh))
(if (or (/= wh "D") (/= wh "C"))
(setq fr 1.00))
(if (= wh "D")
(setq fr 0.80))
(if (= wh "C")
(setq fr 0.66))
(setq pt (getpoint "\n Etext insertion point :"))
(princ "\ntext height-inches <")
(setq ib (open "etext.dft" "r"))
(setq sh (atof (read-line ib)))
(close ib)
(prin1 sh)
(prin1 '>)
(setq sy (getstring " :"))
(if (= sy "")
(setq sh sh)
(setq sh (atof sy))
)
(setq ib (open "etext.dft" "w"))
(setq ie (rtos sh 2 2))
(write-line ie ib)
(close ib)
(setq sl (strlen (setq ss (getstring T "\n text :"))))
(setvar "cmdecho" 0)
(setq fl (open "etext.dt1" "r"))
(setq ct 0 lt nil)
(while (< ct 52) ;read in character spaces
(setq ld (read-line fl))
(setq lt (cons ld lt))
(setq ct (1+ ct))
)
(setq lt (reverse lt))
(setq ct 1 es (1- (strlen ss)))
(setq sj (substr ss 1 1))
(close fl)
(while (< ct sl) ;put in spaces routine
; here should go the routine to figure out which block to insert
(setq l1 (substr ss ct 1) l2 (substr ss (1+ ct) 1))
(setq lw (ascii l1) lx (ascii l2))
(if (and (< lx 96) (= ct 1))
(progn
(setq eu (strcat "EBK" (itoa lw)))
(command "insert" eu pt (* fr (/ sh 24)) (/ sh 24) 0)
))
(if (and (> lx 96) (= ct 1))
(progn
(setq eu (strcat "EBK" (itoa lw)))
(command "insert" eu pt (* fr (/ sh 24)) (/ sh 24) 0)
))
;*********************************
(if (and (/= 32 lx) (/= 45 lx) (/= 46 lx) (/= 47 lx))
(progn
(if (and (< lx 96) (< lw 96))
(ucase))
(if (and (< lw 96) (> lx 96))
(ulcase))
(if (and (> lw 96) (> lx 96))
(lcase))
(setq cg (substr cg 2))
(setq cx (atof cg))
))
;*********************************
(if (or (= 32 lx) (= 45 lx) (= 46 lx) (= 47 lx))
(progn
(if (< lw 96)
(progn
(setq cs (- lw 65) F (/ SH 24))
(setq dx (atof (substr (nth cs lt) 2)))
))
(if (> lw 96)
(progn
(setq cs (- lw 97) F (/ SH 24))
(setq dx (atof (substr (nth (+ 26 cs) lt) 2)))
))
))
;*********************************
(setq ro 0) ;this is the test condition T./ 1 or t./ 2 in slash routine
(if (= 46 lx)
(progn
(setq tq pt)
(if (= l1 (car (member l1 '("Y" "W" "V" "T" "P" "F"))))
(setq tq (list (+ (car tq) (* fr (* dx f))) (+ (cadr tq) 0.0)) ro 1)
(setq tq (list (+ (car tq) (* fr (+ (* 4.33 f) (* dx f)))) (+ (cadr tq) 0.0)) ro 2)
)
(command "insert" "ebk46" tq f f 0)
(if (= (substr ss (+ ct 2) 1) "-")
(progn
(setq ct (1+ ct))
(gethyp)))
(if (= (substr ss (+ ct 2) 1) "/")
(progn
(setq ct (1+ ct))
(getsla)))
(if (= (substr ss (+ ct 2) 1) "")
(progn
(setq ct (+ ct 10))))
(if (= (substr ss (+ ct 2) 1) " ")
(progn
(setq pt (list (+ (car pt) (* fr (+ sh (* dx f)))) (+ (cadr pt) 0.0)))
(setq ct (+ ct 2))
(setq lw (ascii (substr ss (1+ ct) 1)))
(setq eu (strcat "EBK" (itoa lw)))
(setq ej (* f fr))
(command "insert" eu pt ej f 0)
(setq ct (1+ ct))
))
))
;*********************************
(if (= 32 lx)
(progn
(setq pt (list (+ (car pt) (* fr (+ sh (* dx f)))) (+ (cadr pt) 0.0)))
(setq ct (1+ ct))
(setq lw (ascii (substr ss (1+ ct) 1)))
(setq eu (strcat "EBK" (itoa lw)))
(setq ej (* f fr))
(command "insert" eu pt ej f 0)
(setq ct (1+ ct))
))
;***************************
(if (= lx 45)
(gethyp)
)
;***************************
(if (= lx 47)
(getsla)
)
;***************************
(if (and (/= lx 32) (/= 45 lx) (/= lx 46) (/= lx 47) (/= da 1))
(progn
(setq cx (* cx f))
(setq pt (list (+ (car pt) (* fr cx)) (+ (cadr pt) 0.0)))
(setq eu (strcat "EBK" (itoa lx)))
(setq ej (* fr f))
(command "insert" eu pt ej f 0)
(setq ct (1+ ct))
)
)
(setq da 0)
;***************************
)
(setvar "cmdecho" 1)
)